#pragma once

#include "TreeNode.h"
class AST {
	private:
		TreeNodeType mTree_node_type;
		TreeNode* root;
	public:
		AST(void);
		~AST(void);
		///create TreeNode which only has a type, like "stmtLst", "+". 
		TreeNode* createTreeNode(TreeNodeType);
		///create TreeNode which has a type and content. The content is the index of the a stmt or var.
		TreeNode* createTreeNode(TreeNodeType,int);
		
		void setRoot(TreeNode*);
		TreeNode* getRoot();
		
		/*!
		add the second TreeNode as the child of the first TreeNode, place at the end 
		and add the first TreeNode as parent of the second TreeNode
		*/
		void linkNodes(TreeNode*,TreeNode*);

		/*!
		add the second TreeNode as the child of the first TreeNode, place at the front
		and add the first TreeNode as parent of the second TreeNode
		*/
		void linkNodesFront(TreeNode*,TreeNode*);

		///return true is the type of TreeNode matches with the given TreeNodeType
		bool matchesNodeType(TreeNode*, TreeNodeType);

		///return the content inside the node
		int getContentStoredIn(TreeNode*);

};